/*
 * Altitude detection by barometric pressure sensing.
 *
 * In Flying Fox this is based on the Hope RF HP03 pressure sensor
 *
 * by Zik Saleeba 2008-02-12
 */

#ifndef HP03_H
#define HP03_H

#define ALT_ERROR -1.0e6

/*
 * NAME:        HP03_Init
 * ACTION:      Initialise the HP03 sensor. This sets up the 32768Hz output as well.
 */
void HP03_Init(void);

/*
 * NAME:        HP03_GetAltitude
 * ACTION:      Get the current altitude by reading the barometric pressure
 * PARAMETERS:  double *Temperature - optionally the temperature can be placed here.
 *                  If non-NULL, set to the temperature in tenths of degrees celcius
 * RETURNS:     double - the altitude in metres of elevation above sea level
 *                  or ALT_ERROR on error.
 */
 
double HP03_GetAltitude(double *Temperature);


/*
 * NAME:        HP03_GetTemperature
 * ACTION:      Get the current temperature only
 * RETURNS:     double - the temperature in degrees celcius
 *                    or ALT_ERROR on error
 */

double HP03_GetTemperature(void);

#endif /* HP03_H */
